package routers

import (
	"bytes"
	"encoding/json"
	"net/http"
	"shqsoft.cn/pasnj/base"

	"github.com/labstack/echo"
	"github.com/tealeg/xlsx"
)

type QxData struct {
	QX   string `json:"qx"`
	HKJE string `json:"hkje"`
}

//ExportEvaRouter 导出eva数据到xlsx
func ExportEvaRouter(c echo.Context) error {
	var params map[string]interface{}
	paramsStr := c.FormValue("params")
	if paramsStr == "" {
		return echo.NewHTTPError(http.StatusBadRequest, "参数params不能为空！")
	}
	err := json.Unmarshal([]byte(paramsStr), &params)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, err.Error())
	}
	qxDataStr := c.FormValue("qxData")
	if qxDataStr == "" {
		return echo.NewHTTPError(http.StatusBadRequest, "参数qxData不能为空！")
	}
	var qxdatas []QxData
	err = json.Unmarshal([]byte(qxDataStr), &qxdatas)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, err.Error())
	}
	workDir, err := base.WorkDir()
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, err.Error())
	}
	tplPath := workDir + "/evatpl/EVACSB_DG.xlsx"
	isdg := true
	zc_ywpz := base.ToString(params["zc_ywpz"])
	count := 16
	if zc_ywpz == "16" || zc_ywpz == "17" || zc_ywpz == "18" || zc_ywpz == "19" {
		isdg = false
		count = 21
	}
	if !isdg {
		tplPath = workDir + "/evatpl/EVACSB_LS.xlsx"
	}
	file, err := xlsx.OpenFile(tplPath)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, err.Error())
	}
	params = paramsNames(params)
	//贷款
	sheet := file.Sheets[0]
	cell := sheet.Cell(2, 1)
	cell.SetValue(params["zc_ywpz_nm"])
	cell = sheet.Cell(3, 1)
	cell.SetValue(params["zc_ftp_nm"])
	cell = sheet.Cell(4, 1)
	cell.SetValue(params["zc_ftpxs"])
	cell = sheet.Cell(5, 1)
	cell.SetValue(params["zc_ftpts"])
	cell = sheet.Cell(6, 1)
	cell.SetValue(params["zc_czcb"])
	cell = sheet.Cell(7, 1)
	cell.SetValue(params["zc_tdfl"])
	cell = sheet.Cell(8, 1)
	cell.SetValue(params["zc_sqlv"])
	cell = sheet.Cell(9, 1)
	cell.SetValue(params["zc_je"])
	cell = sheet.Cell(10, 1)
	cell.SetValue(params["mnlr_zclr"])
	//存款
	cell = sheet.Cell(2, 3)
	cell.SetValue(params["ck_ywpz_nm"])
	cell = sheet.Cell(3, 3)
	cell.SetValue(params["ck_ftp_nm"])
	cell = sheet.Cell(4, 3)
	cell.SetValue(params["ck_ftpxs"])
	cell = sheet.Cell(5, 3)
	cell.SetValue(params["ck_ftpts"])
	cell = sheet.Cell(6, 3)
	cell.SetValue(params["ck_sqlv"])
	cell = sheet.Cell(7, 3)
	cell.SetValue(params["ck_je"])
	cell = sheet.Cell(8, 3)
	cell.SetValue(params["mnlr_cklr"])
	//中间业务
	cell = sheet.Cell(12, 3)
	cell.SetValue(params["zs_je"])
	cell = sheet.Cell(13, 3)
	cell.SetValue(params["zs_fl"])
	cell = sheet.Cell(14, 3)
	cell.SetValue(params["zs_qx"])
	cell = sheet.Cell(15, 3)
	cell.SetValue(params["zs_sqzs"])
	cell = sheet.Cell(16, 3)
	cell.SetValue(params["mnlr_shzs"])
	if isdg {
		//表内减值
		cell = sheet.Cell(31, 1)
		cell.SetValue(params["jz_xzbn"])
		cell = sheet.Cell(32, 1)
		cell.SetValue(params["jz_bnpj_nm"])
		cell = sheet.Cell(33, 1)
		cell.SetValue(params["jz_bnpjxs"])
		//表外减值
		cell = sheet.Cell(31, 3)
		cell.SetValue(params["jz_xzbw"])
		cell = sheet.Cell(32, 3)
		cell.SetValue(params["jz_bwpj_nm"])
		cell = sheet.Cell(33, 3)
		cell.SetValue(params["jz_bwpjxs"])
		//经济资本对公
		cell = sheet.Cell(36, 1)
		cell.SetValue(params["jg_cpqz_nm"])
		cell = sheet.Cell(36, 3)
		cell.SetValue(params["jg_cpqzxs"])
		cell = sheet.Cell(37, 1)
		cell.SetValue(params["jg_khpj_nm"])
		cell = sheet.Cell(37, 3)
		cell.SetValue(params["jg_khpjxs"])
		cell = sheet.Cell(38, 1)
		cell.SetValue(params["jg_dzylx_nm"])
		cell = sheet.Cell(38, 3)
		cell.SetValue(params["jg_dzyfsxs"])
		cell = sheet.Cell(39, 1)
		cell.SetValue(params["jg_dbbzlx_nm"])
		cell = sheet.Cell(39, 3)
		cell.SetValue(params["jg_dbbzlxxs"])
		cell = sheet.Cell(40, 1)
		cell.SetValue(params["jg_qx_nm"])
		cell = sheet.Cell(40, 3)
		cell.SetValue(params["jg_qxxs"])
		cell = sheet.Cell(41, 1)
		cell.SetValue(params["jg_gm_nm"])
		cell = sheet.Cell(41, 3)
		cell.SetValue(params["jg_gm_xs"])
		cell = sheet.Cell(42, 1)
		cell.SetValue(params["jg_hy_nm"])
		cell = sheet.Cell(42, 3)
		cell.SetValue(params["jg_hyxs"])
		cell = sheet.Cell(43, 1)
		cell.SetValue(params["jg_bzjbl"])
		cell = sheet.Cell(44, 1)
		cell.SetValue(params["jjzb_zbzy"])
		cell = sheet.Cell(44, 3)
		cell.SetValue(params["jjzb_zbcb"])
	} else {
		//表内减值
		cell = sheet.Cell(36, 1)
		cell.SetValue(params["jz_xzbn"])
		cell = sheet.Cell(37, 1)
		cell.SetValue(params["jz_bnpj_nm"])
		cell = sheet.Cell(38, 1)
		cell.SetValue(params["jz_bnpjxs"])
		//表外减值
		cell = sheet.Cell(36, 3)
		cell.SetValue(params["jz_xzbw"])
		cell = sheet.Cell(37, 3)
		cell.SetValue(params["jz_bwpj_nm"])
		cell = sheet.Cell(38, 3)
		cell.SetValue(params["jz_bwpjxs"])
		//经济资本零售
		cell = sheet.Cell(41, 1)
		cell.SetValue(params["js_cpqz_nm"])
		cell = sheet.Cell(41, 3)
		cell.SetValue(params["js_cpqzxs"])
		cell = sheet.Cell(42, 1)
		cell.SetValue(params["js_dbfs_nm"])
		cell = sheet.Cell(42, 3)
		cell.SetValue(params["js_dbfsxs"])
		cell = sheet.Cell(43, 1)
		cell.SetValue(params["js_bzjbl"])
		cell = sheet.Cell(44, 1)
		cell.SetValue(params["jjzb_zbzy"])
		cell = sheet.Cell(44, 3)
		cell.SetValue(params["jjzb_zbcb"])
	}
	//EVA
	cell = sheet.Cell(46, 1)
	cell.SetValue(params["mnlr_hjlr"])
	cell = sheet.Cell(46, 3)
	cell.SetValue(params["jjzb_zbcb"])
	cell = sheet.Cell(47, 1)
	cell.SetValue(params["jzzb_hj"])
	cell = sheet.Cell(47, 3)
	cell.SetValue(params["eva_sdr"])
	cell = sheet.Cell(48, 1)
	cell.SetValue(params["eva_sheva"])
	cell = sheet.Cell(48, 3)
	cell.SetValue(params["eva_zhcb"])
	//期限
	row := 13
	count = count + 13
	for _, qx := range qxdatas {
		if qx.HKJE == "" {
			continue
		}
		cell = sheet.Cell(row, 0)
		cell.SetValue(qx.QX)
		cell = sheet.Cell(row, 1)
		cell.SetValue(qx.HKJE)
		row++
		if row > count {
			break
		}
	}
	buff := new(bytes.Buffer)
	file.Write(buff)
	fileName := "EVA.xlsx"
	c.Response().Header().Set("Content-Type", "application/vnd.ms-excel")
	c.Response().Header().Set("Content-Disposition", "attachment; filename="+fileName)
	c.Response().Write(buff.Bytes())
	return nil
}

func paramsNames(params map[string]interface{}) map[string]interface{} {
	zc_ywpz := base.ToString(params["zc_ywpz"])
	params["zc_ywpz_nm"] = PNAME_DATAS["zc_ywpz"][zc_ywpz]
	zc_ftp := base.ToString(params["zc_ftp"])
	params["zc_ftp_nm"] = YWLB_FTPCS[zc_ywpz][zc_ftp]
	ck_ywpz := base.ToString(params["ck_ywpz"])
	params["ck_ywpz_nm"] = PNAME_DATAS["ck_ywpz"][ck_ywpz]
	ck_ftp := base.ToString(params["ck_ftp"])
	params["ck_ftp_nm"] = YWLB_FTPCS[ck_ywpz][ck_ftp]
	jz_bnpj := base.ToString(params["jz_bnpj"])
	params["jz_bnpj_nm"] = PNAME_DATAS["jz_bnpj"][jz_bnpj]
	jz_bwpj := base.ToString(params["jz_bwpj"])
	params["jz_bwpj_nm"] = PNAME_DATAS["jz_bwpj"][jz_bwpj]
	jg_cpqz := base.ToString(params["jg_cpqz"])
	params["jg_cpqz_nm"] = PNAME_DATAS["jg_cpqz"][jg_cpqz]
	jg_khpj := base.ToString(params["jg_khpj"])
	params["jg_khpj_nm"] = PNAME_DATAS["jg_khpj"][jg_khpj]
	jg_dzyfs := base.ToString(params["jg_dzyfs"])
	params["jg_dzylx_nm"] = PNAME_DATAS["jg_dzyfs"][jg_dzyfs]
	jg_dbbzlx := base.ToString(params["jg_dbbzlx"])
	jg_bzrpj := base.ToString(params["jg_bzrpj"])
	if jg_dbbzlx == "1" || jg_dbbzlx == "2" || jg_dbbzlx == "6" {
		params["jg_dbbzlx_nm"] = PNAME_DATAS["jg_dbbzlx"][jg_dbbzlx] + "--评级:" + PNAME_DATAS["jg_bzrpj"][jg_bzrpj]
	} else {
		params["jg_dbbzlx_nm"] = PNAME_DATAS["jg_dbbzlx"][jg_dbbzlx]
	}
	jg_qx := base.ToString(params["jg_qx"])
	params["jg_qx_nm"] = PNAME_DATAS["jg_qx"][jg_qx]
	jg_gm := base.ToString(params["jg_gm"])
	params["jg_gm_nm"] = PNAME_DATAS["jg_gm"][jg_gm]
	jg_hy := base.ToString(params["jg_hy"])
	params["jg_hy_nm"] = PNAME_DATAS["jg_hy"][jg_hy]
	js_cpqz := base.ToString(params["js_cpqz"])
	params["js_cpqz_nm"] = PNAME_DATAS["js_cpqz"][js_cpqz]
	js_dbfs := base.ToString(params["js_dbfs"])
	params["js_dbfs_nm"] = PNAME_DATAS["js_dbfs"][js_dbfs]
	return params
}

var YWLB_FTPCS map[string]map[string]string = map[string]map[string]string{
	"11": FTPDK,
	"12": FTPDK,
	"13": FTPDK,
	"14": FTPZT,
	"15": FTPTYZT,
	"16": FTPDK,
	"17": FTPDK,
	"18": FTPDK,
	"19": FTPDK,
	"20": FTPWBCDK,
	"31": FTPDGCK,
	"32": FTPGSJGX,
	"33": FTPBBLC,
	"34": FTPBBLC,
	"35": FTPWBCDK,
	"36": FTPCXCK,
	"37": FTPGRJGX,
	"38": FTPBBLC,
	"39": FTPBBLC,
	"40": FTPWBCDK,
}

//内部评级，减值计提比例
var NBPJ_JZLTBL map[string]string = map[string]string{
	"0":   "0",
	"0-1": "0-1",
	"0-2": "0-2",
	"0-3": "0-3",
	"1":   "1",
	"2":   "2",
	"3":   "3",
	"4":   "4",
	"5":   "5",
	"6":   "6",
	"7":   "7",
	"8":   "8",
	"9":   "9",
	"10":  "10",
	"11":  "11",
	"12":  "12",
	"13":  "13",
	"D":   "D",
	"zt":  "直贴",
	"qt":  "其它",
}

//资产业务类别
var ZCYWLB map[string]string = map[string]string{
	"11": "一般企业贷款",
	"12": "普惠小微企业贷款",
	"13": "民营企业贷款",
	"14": "票据直贴",
	"15": "同业直投",
	"16": "个人住房贷款",
	"17": "个人经营性贷款",
	"18": "个人消费贷款",
	"19": "其它个人贷款",
	"20": "外币贷款",
}

//存款业务类别
var CKYWLB map[string]string = map[string]string{
	"31": "公司存款",
	"32": "单位结构性存款",
	"33": "机构理财",
	"34": "公司大额存单",
	"35": "外币公司存款",
	"36": "储蓄存款",
	"37": "个人结构性存款",
	"38": "个人保本理财",
	"39": "个人大额存单",
	"40": "外币储蓄存款",
}

//直贴FTP
var FTPZT map[string]string = map[string]string{
	"9904": "直贴本币ftp价格-6个月",
	"9910": "直贴本币ftp价格-1年",
}

//贷款FTP
var FTPDK map[string]string = map[string]string{
	"20170101": "人民币固定利率贷款-隔夜",
	"20170102": "人民币固定利率贷款-1周",
	"20170103": "人民币固定利率贷款-2周",
	"20170104": "人民币固定利率贷款-1个月",
	"20170105": "人民币固定利率贷款-3个月",
	"20170106": "人民币固定利率贷款-6个月",
	"20170107": "人民币固定利率贷款-1年",
	"20170108": "人民币固定利率贷款-2年",
	"20170109": "人民币固定利率贷款-3年",
	"20170110": "人民币固定利率贷款-4年",
	"20170111": "人民币固定利率贷款-5年",
	"20170112": "人民币固定利率贷款-6年",
	"20170113": "人民币固定利率贷款-7年",
	"20170114": "人民币固定利率贷款-8年",
	"20170115": "人民币固定利率贷款-10年",
	"20170116": "人民币固定利率贷款-15年",
	"20170117": "人民币固定利率贷款-20年",
	"20170201": "人民币浮动利率贷款-隔夜",
	"20170202": "人民币浮动利率贷款-1周",
	"20170203": "人民币浮动利率贷款-2周",
	"20170204": "人民币浮动利率贷款-1个月",
	"20170205": "人民币浮动利率贷款-3个月",
	"20170206": "人民币浮动利率贷款-6个月",
	"20170207": "人民币浮动利率贷款-1年",
	"20170208": "人民币浮动利率贷款-2年",
	"20170209": "人民币浮动利率贷款-3年",
	"20170210": "人民币浮动利率贷款-4年",
	"20170211": "人民币浮动利率贷款-5年",
	"20170212": "人民币浮动利率贷款-6年",
	"20170213": "人民币浮动利率贷款-7年",
	"20170214": "人民币浮动利率贷款-8年",
	"20170215": "人民币浮动利率贷款-10年",
	"20170216": "人民币浮动利率贷款-15年",
	"20170217": "人民币浮动利率贷款-20年",
}

//对公存款FTP
var FTPDGCK map[string]string = map[string]string{
	"20170301": "人民币对公存款-隔夜",
	"20170302": "人民币对公存款-1周",
	"20170303": "人民币对公存款-2周",
	"20170304": "人民币对公存款-1个月",
	"20170305": "人民币对公存款-3个月",
	"20170306": "人民币对公存款-6个月",
	"20170307": "人民币对公存款-1年",
	"20170308": "人民币对公存款-2年",
	"20170309": "人民币对公存款-3年",
	"20170310": "人民币对公存款-4年",
	"20170311": "人民币对公存款-5年",
	"20170312": "人民币对公存款-6年",
	"20170313": "人民币对公存款-7年",
	"20170314": "人民币对公存款-8年",
	"20170315": "人民币对公存款-10年",
}

//储蓄存款FTP
var FTPCXCK map[string]string = map[string]string{
	"20170401": "人民币储蓄存款-隔夜",
	"20170402": "人民币储蓄存款-1周",
	"20170403": "人民币储蓄存款-2周",
	"20170404": "人民币储蓄存款-1个月",
	"20170405": "人民币储蓄存款-3个月",
	"20170406": "人民币储蓄存款-6个月",
	"20170407": "人民币储蓄存款-1年",
	"20170408": "人民币储蓄存款-2年",
	"20170409": "人民币储蓄存款-3年",
	"20170410": "人民币储蓄存款-4年",
	"20170411": "人民币储蓄存款-5年",
	"20170412": "人民币储蓄存款-6年",
	"20170413": "人民币储蓄存款-7年",
	"20170414": "人民币储蓄存款-8年",
	"20170415": "人民币储蓄存款-10年",
}

//保本理财FTP
var FTPBBLC map[string]string = map[string]string{
	"20170501": "人民币保本理财-隔夜",
	"20170502": "人民币保本理财-1周",
	"20170503": "人民币保本理财-2周",
	"20170504": "人民币保本理财-1个月",
	"20170505": "人民币保本理财-3个月",
	"20170506": "人民币保本理财-6个月",
	"20170507": "人民币保本理财-1年",
	"20170508": "人民币保本理财-2年",
	"20170509": "人民币保本理财-3年",
	"20170510": "人民币保本理财-4年",
	"20170511": "人民币保本理财-5年",
}

//外币存贷款FTP
var FTPWBCDK map[string]string = map[string]string{
	"20170601": "外币存贷款-隔夜",
	"20170602": "外币存贷款-1周",
	"20170603": "外币存贷款-2周",
	"20170604": "外币存贷款-1个月",
	"20170605": "外币存贷款-3个月",
	"20170606": "外币存贷款-6个月",
	"20170607": "外币存贷款-1年",
	"20170608": "外币存贷款-2年",
	"20170609": "外币存贷款-3年",
	"20170610": "外币存贷款-4年",
	"20170611": "外币存贷款-5年",
}

//公司结构性存款FTP
var FTPGSJGX map[string]string = map[string]string{
	"20170701": "人民币公司结构性存款-隔夜",
	"20170702": "人民币公司结构性存款-1周",
	"20170703": "人民币公司结构性存款-2周",
	"20170704": "人民币公司结构性存款-1个月",
	"20170705": "人民币公司结构性存款-3个月",
	"20170706": "人民币公司结构性存款-6个月",
	"20170707": "人民币公司结构性存款-1年",
}

//个人结构性存款FTP
var FTPGRJGX map[string]string = map[string]string{
	"20170801": "人民币个人结构性存款-隔夜",
	"20170802": "人民币个人结构性存款-1周",
	"20170803": "人民币个人结构性存款-2周",
	"20170804": "人民币个人结构性存款-1个月",
	"20170805": "人民币个人结构性存款-3个月",
	"20170806": "人民币个人结构性存款-6个月",
	"20170807": "人民币个人结构性存款-1年",
}

//同业直投业务FTP
var FTPTYZT map[string]string = map[string]string{
	"20190701": "信贷类同业投资FTP-7天",
	"20190702": "信贷类同业投资FTP-14天",
	"20190703": "信贷类同业投资FTP-1个月",
	"20190704": "信贷类同业投资FTP-2个月",
	"20190705": "信贷类同业投资FTP-3个月",
	"20190706": "信贷类同业投资FTP-4个月",
	"20190707": "信贷类同业投资FTP-5个月",
	"20190708": "信贷类同业投资FTP-6个月",
	"20190709": "信贷类同业投资FTP-9个月",
	"20190710": "信贷类同业投资FTP-1年",
	"20190711": "信贷类同业投资FTP-2年",
	"20190712": "信贷类同业投资FTP-3年",
	"20190713": "信贷类同业投资FTP-4年",
	"20190714": "信贷类同业投资FTP-5年",
}
var JJZB_LSYW_DBFX map[string]string = map[string]string{
	"1":  "质押-存单",
	"2":  "质押-政府债券",
	"3":  "质押-人民币理财",
	"4":  "质押-应收账款",
	"5":  "质押-股票/股权",
	"6":  "质押-权利质押",
	"7":  "质押-其他质押",
	"8":  "抵押-居住用房",
	"9":  "抵押-商业性用房",
	"10": "抵押-土地使用权",
	"11": "抵押-车辆",
	"12": "抵押-其他抵押",
}

var JJZB_LSYW_YWPZ map[string]string = map[string]string{
	"1":  "零售业务-表内业务-个人住房贷款",
	"2":  "零售业务-表内业务-个人汽车贷款",
	"3":  "零售业务-表内业务-个人商用房贷款",
	"4":  "零售业务-表内业务-个人助学贷款",
	"5":  "零售业务-表内业务-个人抵质押贷款",
	"6":  "零售业务-表内业务-个人保证贷款",
	"7":  "零售业务-表内业务-个人信用贷款",
	"8":  "零售业务-表内业务-其他贷款",
	"9":  "零售业务-表内业务-信用卡透支",
	"10": "零售业务-表外业务-信用卡未使用额度",
	"11": "零售业务-表外业务-信用卡未使用额度CCF",
}
var JJZB_DGYW_CPQZ map[string]string = map[string]string{
	"1":  "公司业务-表内业务-一般贷款",
	"2":  "公司业务-表内业务-贸易融资",
	"3":  "公司业务-表内业务-各项垫款",
	"4":  "公司业务-表内业务-银行承兑汇票贴现",
	"5":  "公司业务-表内业务-商业承兑汇票贴现",
	"6":  "公司业务-表内业务-买入外币票据",
	"7":  "公司业务-表外业务-银行承兑汇票",
	"8":  "公司业务-表外业务-融资类保函",
	"9":  "公司业务-表外业务-非融资保函及其他担保",
	"10": "公司业务-表外业务-非融资保函及其他担保CCF",
	"11": "公司业务-表外业务-信用证",
	"12": "公司业务-表外业务-信用证CCF",
	"13": "公司业务-表外业务-贷款承诺",
	"14": "公司业务-表外业务-信用证CCF",
}
var JJZB_DGYW_KHPJ map[string]string = map[string]string{
	"1":  "1",
	"2":  "2",
	"3":  "3",
	"4":  "4",
	"5":  "5",
	"6":  "6",
	"7":  "7",
	"8":  "8",
	"9":  "9",
	"10": "10",
	"11": "11",
	"12": "12",
	"13": "13",
	"14": "未评级",
}
var JJZB_DGYW_DZYLX map[string]string = map[string]string{
	"1": "质押",
	"2": "抵押",
}
var JJZB_DGYW_ZYXS map[string]string = map[string]string{
	"1":  "质押-金融质押品-现金及其等价物-保证金",
	"2":  "质押-金融质押品-现金及其等价物-存单",
	"3":  "质押-金融质押品-现金及其等价物-理财产品",
	"4":  "质押-金融质押品-现金及其等价物-现汇",
	"5":  "质押-金融质押品-票据-中国人民银行票据",
	"6":  "质押-金融质押品-票据-商业银行本票/银行汇票",
	"7":  "质押-金融质押品-票据-银行承兑汇票",
	"8":  "质押-金融质押品-票据-商业承兑汇票",
	"9":  "质押-金融质押品-票据-票据池",
	"10": "质押-金融质押品-债券-国债",
	"11": "质押-金融质押品-保单-其他具有现金价值的保险单",
	"12": "质押-金融质押品-股票-基金",
	"13": "质押-金融质押品-贵金属-黄金",
	"14": "质押-应收账款-应收账款-应收账款",
	"15": "质押-应收账款-交易类应收账款-交易类应收账款",
	"16": "质押-应收账款-公路收费权-公路收费权",
	"17": "质押-应收账款-其他收费权-城市基础设施收费权",
	"18": "质押-应收账款-其他收费权-农村电网建设与改造工程电费收费权",
	"19": "质押-应收账款-其他收费权-提供其他公共服务产生的收费权",
	"20": "质押-应收账款-其他收费权-污水处理收费权",
	"21": "质押-其他质押品-出口退税账户-出口退税账户",
	"22": "质押-其他质押品-流动资产-保函",
	"23": "质押-其他质押品-流动资产-仓单",
	"24": "质押-其他质押品-流动资产-提单",
	"25": "质押-其他质押品-无形资产-可转让知识产权的财产权",
	"26": "质押-其他质押品-无追索权保理-无追索权保理",
	"27": "质押-其他质押品-有追索权保理-有追索权保理",
	"28": "质押-其他质押品-其他质押品-其他质押品",
	"29": "质押-缺失-缺失-缺失",
	"30": "抵押-商用房地产和居住用房地产-居住用房地产-居住用房",
	"31": "抵押-商用房地产和居住用房地产-商用房地产-办公用房",
	"32": "抵押-商用房地产和居住用房地产-商用房地产-工业用房",
	"33": "抵押-商用房地产和居住用房地产-商用房地产-商业用房",
	"34": "抵押-商用房地产和居住用房地产-居住用建设用地使用权-商用建设用地使用权",
	"35": "抵押-商用房地产和居住用房地产-土地使用权及在建工程-土地使用权及在建工程",
	"36": "抵押-商用房地产和居住用房地产-房产类在建工程-居住用房产类在建工程",
	"37": "抵押-商用房地产和居住用房地产-房产类在建工程-商用房产类在建工程",
	"38": "抵押-其他抵押品-机器设备-电气设备",
	"39": "抵押-其他抵押品-机器设备-电子产品及通信设备",
	"40": "抵押-其他抵押品-机器设备-通用设备",
	"41": "抵押-其他抵押品-机器设备-专用设备",
	"42": "抵押-其他抵押品-机器设备-机器设备（不能独立设定抵押）",
	"43": "抵押-其他抵押品-交通运输设备-车辆",
	"44": "抵押-其他抵押品-交通运输设备-船舶",
	"45": "抵押-其他抵押品-管网、设备-管网、设备",
	"46": "抵押-其他抵押品-流动资产-存货",
	"47": "抵押-其他抵押品-流动资产-流动资产",
	"48": "抵押-其他抵押品-设施类在建工程-设施类在建工程",
	"49": "抵押-其他抵押品-资源资产-森林资源",
	"50": "抵押-其他抵押品-资源资产-资源资产",
	"51": "抵押-缺失-缺失-缺失",
}
var JJZB_DGYW_DYXS map[string]string = map[string]string{
	"30": "抵押-商用房地产和居住用房地产-居住用房地产-居住用房",
	"31": "抵押-商用房地产和居住用房地产-商用房地产-办公用房",
	"32": "抵押-商用房地产和居住用房地产-商用房地产-工业用房",
	"33": "抵押-商用房地产和居住用房地产-商用房地产-商业用房",
	"34": "抵押-商用房地产和居住用房地产-居住用建设用地使用权-商用建设用地使用权",
	"35": "抵押-商用房地产和居住用房地产-土地使用权及在建工程-土地使用权及在建工程",
	"36": "抵押-商用房地产和居住用房地产-房产类在建工程-居住用房产类在建工程",
	"37": "抵押-商用房地产和居住用房地产-房产类在建工程-商用房产类在建工程",
	"38": "抵押-其他抵押品-机器设备-电气设备",
	"39": "抵押-其他抵押品-机器设备-电子产品及通信设备",
	"40": "抵押-其他抵押品-机器设备-通用设备",
	"41": "抵押-其他抵押品-机器设备-专用设备",
	"42": "抵押-其他抵押品-机器设备-机器设备（不能独立设定抵押）",
	"43": "抵押-其他抵押品-交通运输设备-车辆",
	"44": "抵押-其他抵押品-交通运输设备-船舶",
	"45": "抵押-其他抵押品-管网、设备-管网、设备",
	"46": "抵押-其他抵押品-流动资产-存货",
	"47": "抵押-其他抵押品-流动资产-流动资产",
	"48": "抵押-其他抵押品-设施类在建工程-设施类在建工程",
	"49": "抵押-其他抵押品-资源资产-森林资源",
	"50": "抵押-其他抵押品-资源资产-资源资产",
	"51": "抵押-缺失-缺失-缺失",
}
var JJZB_DGYW_DBBZLX map[string]string = map[string]string{
	"1":  "专业担保公司担保",
	"2":  "一般法人保证",
	"3":  "自然人保证",
	"4":  "备用信用证保证",
	"5":  "银行保函保证",
	"6":  "集团母公司担保",
	"7":  "市区政府承诺函保证",
	"8":  "担保基金保证",
	"9":  "其他保证",
	"10": "缺失",
}
var JJZB_DGYW_BZRXS map[string]string = map[string]string{
	"1":  "0-1",
	"2":  "0-2",
	"3":  "0-3",
	"4":  "1",
	"5":  "2",
	"6":  "3",
	"7":  "4",
	"8":  "5",
	"9":  "6",
	"10": "7",
	"11": "8",
	"12": "9",
	"13": "10",
	"14": "11",
	"15": "12",
	"16": "13",
	"17": "未评级",
}
var JJZB_DGYW_QX map[string]string = map[string]string{
	"1": "3个月以内（含）",
	"2": "3个月-6个月（含）",
	"3": "6个月-1年（含）",
	"4": "1年-3年（含）",
	"5": "3年-5年（含）",
	"6": "5年-10年（含）",
	"7": "10年以上",
}
var JJZB_DGYW_GM map[string]string = map[string]string{
	"1": "符合标准的小微企业",
	"2": "中小企业（不含小微企业）",
	"3": "一般公司",
}
var JJZB_DGYW_HY map[string]string = map[string]string{
	"1": "黑色金属冶炼和压延加工业",
	"2": "铝冶炼",
	"3": "水泥、石灰和石膏制造",
	"4": "平板玻璃制造",
	"5": "船舶及相关装置制造",
	"6": "房地产业",
	"7": "采矿业",
	"8": "其他",
}
var PNAME_DATAS map[string]map[string]string = map[string]map[string]string{
	"zc_ywpz":   ZCYWLB,
	"zc_ftp":    FTPDK,
	"ck_ywpz":   CKYWLB,
	"ck_ftp":    FTPDGCK,
	"jg_cpqz":   JJZB_DGYW_CPQZ,
	"jg_khpj":   JJZB_DGYW_KHPJ,
	"jg_dzylx":  JJZB_DGYW_DZYLX,
	"jg_dzyfs":  JJZB_DGYW_ZYXS,
	"jg_dbbzlx": JJZB_DGYW_DBBZLX,
	"jg_bzrpj":  JJZB_DGYW_BZRXS,
	"jg_qx":     JJZB_DGYW_QX,
	"jg_gm":     JJZB_DGYW_GM,
	"jg_hy":     JJZB_DGYW_HY,
	"js_cpqz":   JJZB_LSYW_YWPZ,
	"js_dbfs":   JJZB_LSYW_DBFX,
	"jz_bnpj":   NBPJ_JZLTBL,
	"jz_bwpj":   NBPJ_JZLTBL,
}
